cmake_minimum_required(VERSION 3.5.1)

project(template LANGUAGES C VERSION 0.0.1)

add_subdirectory(lib/SocketUtils)
add_subdirectory(lib/FinalC)
add_subdirectory(lib/Thread)
# target_include_directories(${MODULE_NAME} PRIVATE
#     ${FinalC_INCLUDE_DIRS}
# )
# target_link_libraries(${MODULE_NAME}
#     ${FinalC_LIBRARIES}
# )


function(add_config _NAME)
    # foreach(item IN LISTS ARGN))
        add_executable(${_NAME} ${ARGN})
        target_include_directories(${_NAME} PRIVATE
            ${SocketUtils_INCLUDE_DIRS}
            ${FinalC_INCLUDE_DIRS}
            ${Thread_INCLUDE_DIRS}
        )
        target_link_libraries(${_NAME}
            ${SocketUtils_LIBRARIES}
            ${FinalC_LIBRARIES}
            ${Thread_LIBRARIES}
            Log
        )
    # endforeach(item IN LISTS ARGN))
endfunction(add_config)


add_config(${PROJECT_NAME} main.c)
add_config(Server Server.c)
add_config(Client Client.c)

add_config(ChatRoomClient ChatRoomClient.c)
add_config(ChatRoomServer ChatRoomServer.c)


add_config(ChatRoom ChatRoom.c)